package cn.assumejson.springframework.beans.context;

import cn.assumejson.springframework.beans.factory.BeansException;
import cn.assumejson.springframework.beans.factory.config.BeanFactoryPostProcessor;
import cn.assumejson.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * 提供BeanFactoryPostProcessor模板方法
 *
 * @author Mr. Li
 * @version 1.0
 * @since 1.0 2021/11/30 15:09
 */
public interface ConfigurableApplicationContext extends  ApplicationContext{

    /**
     * 容器刷新
     *
     * @throws BeansException
     */
    void refresh() throws BeansException;

    /**
     * 获取工厂
     *
     * @return ConfigurableListableBeanFactory
     */
    ConfigurableListableBeanFactory getBeanFactory();

    /**
     * 添加BeanFactoryPostProcessor调用链
     *
     * @param beanFactoryPostProcessor BeanFactoryPostProcessor
     */
    void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor);

    /**
     * 往jvm中注册 关闭钩子
     */
    void registerShutdownHook();

    /**
     * 关闭
     */
    void close();
}
